{template header}
<div class="box">
    <div class="box_left">
        <div class="box_left_nav font_gray">
	    → <a href="{SITE_URL}">{$setting['site_name']}</a>
            <!--{loop $navlist $nav}-->
            &gt; <a href="{url category/view/$nav['id']}">{$nav['name']}</a>
            <!--{/loop}-->
        </div>
        <!--左栏 问题 开始-->
        <div class="ask_box">
            <div class="boxtop2_title box_noask_top"><strong>待解决</strong></div>
            <div class="ask_box_sub">
                <div class="ask_left">
                	<!--{if $question['hidden']}-->
                	<img src="{SITE_URL}css/default/avatar.gif"  alt="{$question['author']}" width="51" height="51"><br>匿名
                    <!--{else}-->
                    <a href="{url user/space/$question['authorid']}" target="_blank"><img src="{$question['author_avartar']}"  alt="{$question['author']}" width="51" height="51"></a><br>
                    <a href="{url user/space/$question['authorid']}" target="_blank" title="{$question['author']}">{$question['author']}</a>
                    <!--{/if}-->
                </div>
                <div class="ask_right">
                    <strong>{$question['title']}</strong>
                    <div class="clear"></div>
                    <p id="mydescription" style="word-wrap: break-word; overflow: hidden;" class="ask_sub_description">{$question['description']}</p><br />
                    <!--{if $supplylist}-->
                    <div>
                        <!--{loop $supplylist $supply}-->
                        <span class="font_gray">问题补充  {$supply['format_time']}</span>
                        <p style="word-wrap: break-word; overflow: hidden;">{$supply['content']}</p>
                        <!--{/loop}-->
                    </div>
                    <!--{/if}-->
                    <span class="font_gray">悬赏分:<span class="wy_money">{$question['price']}</span></span>
                    <span class="margin20 font_gray">离问题结束还有：<font color="#ff6600">{$endtime}</font></span><span class="margin20 font_gray">回答数：<font color="#ff6600">{$question['answers']}</font></span><a style="cursor: pointer;" class="margin10 blue2" href="{url question/addfavorite/$question['id']/$question['cid']}">收藏</a><a style="cursor: pointer;" class="margin10 blue2" href="javascript:inform('{$question['author']}',1);">举报</a>
                    <div style="display:none"  id="dealQuestion">
                        <span class="boxtop1_title">处理提问</span><br><p> 如果已获得满意的回答，请及时采纳，感谢回答者。若还没有满意的回答，可以尝试以下操作：</p>
                        <span class="blue2"><a onclick="mysupply();" href="javascript:void(0);"> 补充问题</a></span>
                        <span class="font_gray">补充提问细节，以得到更准确的答案；</span><br>
                        <span class="blue2"><a onclick="addscore();" href="javascript:void(0);">提高悬赏</a></span>
                        <span class="font_gray">提高悬赏，以提高问题的关注度；</span><br>
                        <span class="blue2"><a onclick="document.closeForm.submit();return false;" href="javascript:void(0);">无满意答案</a></span>
                        <span class="font_gray">无满意答案的回答，可以直接结束提问，关闭问题</span>
                        <form name="closeForm" action="{url question/close}" method="post">
                            <input type="hidden" value="{$question['id']}" name="qid">
                        </form>
                    </div>
                    <!--问题管理开始-->
                    <!--{if $user['groupid']==1}-->
                    <div id="dealQuestion">
                        <span class="boxtop1_title">问题管理</span><br>
                        <span class="blue2"><a  onclick="managequest(1);return false;" href="javascript:void(0);">修改标题</a></span>
                        <span class="blue2"><a onclick="managequest(2);return false;" href="javascript:void(0);">编辑内容</a></span>
                        <span class="blue2"><a onclick="managequest(3);return false;" href="javascript:void(0);">移动分类</a></span>
                        <span class="blue2"><a onclick="managequest(4);return false;" href="javascript:void(0);">关闭问题</a></span>
                        <span class="blue2"><a onclick="managequest(6);return false;" href="javascript:void(0);">删除</a></span>
                    </div>
                    <!--{/if}-->
                    <!--问题管理结束-->
                </div>
            </div>
        </div>
        <!--左栏 问题 结束-->
        <!--我来回答 开始-->
        <!--我来回答 开始-->
        <div class="box_left1" style="display:none" id="asropt">
            <div class="boxtop1">
                <div class="boxtop1_title">我来回答</div>
            </div>
            <div class="ask_content">
                <form name="answerForm" action="{url question/answer}" method="post">
                    <input type="hidden" value="{$question['id']}" name="qid">
                    <input type="hidden" value="{$question['title']}" name="title">
                    <textarea id="mycontent" name="content"  rows="12" cols="76" ></textarea>
                    <span class="fL" id="checkcode" style="margin-top: 20px; height: 26px;">验证码:&nbsp;
                        <input name="code" size="12"  tabindex="3" style="vertical-align: middle; width: 83px; text-transform: uppercase;" type="text">
                        <img  id="verifycode"   src="{url user/code}">
                        <a href="javascript:updatecode();">看不清，换一张</a>
                    </span>
                    <span class="fr" style="margin-top: 20px; height: 26px;">
                        <input class="btn_search" type="button" style="vertical-align: middle;" value="提交回答" name="mybutton"  onClick="mylogin();"  />
                    </span>
                </form>
                <div class="clear">
                </div>
            </div>
        </div>
        <!--我来回答 结束-->
        <div id="divGoodanswer">
        </div>
        <!--我来回答 结束-->
        <div class="blank10">
        </div>
        <!--回答内容 开始-->
        <div class="ask_box" id="container">
            <div class="boxtop1">
                <div class="boxtop1_title">网友的回答</div>共<span class="font_orange2">{$question['answers']}</span>条 </div>
            <!-- 答案 begin-->
            <div id="divOtheranswer"  >
                <!--{loop $answerlist $index $answer}-->
                {eval $index++}
                <div class="ask_box_sub1" id="asr{$answer['authorid']}">
                    <div class="ask_left">
                        <a href="{url user/space/$answer['authorid']}" target="_blank"><img src="{$answer['author_avartar']}"  alt="{$answer['author']}" width="51" height="51"></a><br>
                        <a href="{url user/space/$answer['authorid']}" target="_blank" title="{$answer['author']}">{$answer['author']}</a>
                    </div>
                    <div class="ask_right1">
                        <span class="answer_lou">{$index}F</span>
                        <span class="ppp" id="mc{$index}">{$answer['content']}</span>
                        <div class="ask_gai"></div>
                        <div id="apt_{$answer['id']}" style="display:none" class="ask_zhuiwen">
                                <input type="button"  value="采纳为答案" name="adoptanswer" onclick="adoptanswer({$answer['id']});"  class="btn_ask" />
                        </div>
                        <!--{if $answer['status'] }-->
                        <div id="eaopt{$answer['authorid']}" style="display:none" class="ask_zhuiwen">
                                <input type="button"  value="修改答案" name="submit" class="btn_ask" onclick="editanswer({$answer['id']},'mc{$index}');"/>
                        </div>
                        <!--{/if}-->
                        <!--{if $user['groupid']==1}-->
                        <div  class="ask_zhuiwen">
                            <span class="boxtop1_title">回答管理</span><br>
                            <span class="blue2"><a href="javascript:void(0);" onclick="editanswer({$answer['id']},'mc{$index}');return false;">编辑内容</a></span>
                            <span class="blue2"><a href="javascript:delanswer({$answer['id']},{$question['id']});">删除</a></span>
                            <!--{if !$answer['status']}--><span class="blue2"><a href="javascript:verifyanswer({$answer['id']},{$question['id']});">审核</a></span><!--{/if}-->
                        </div>
                        <!--{/if}-->
        				<div class="clean"></div>
        				<span class="ask_right1_footR">回答时间：<font color="#ff6600">{$answer['time']}</font><a class="margin10 blue2"  href="javascript:inform('{$answer['author']}',2);">举报</a></span>
                    </div>
                </div>
                <!--{/loop}-->
            </div>
            <!-- 答案 end-->

            <div id="pagecontent" style="padding-left: 10px; padding-top: 0px; height: 30px;">
                <div id="ask_page" style="padding: 1px 0pt;"></div>
            </div>

        </div>
        <!--回答内容 结束-->
        <div class="blank10">
        </div>
        <!--相关已解决问题 开始-->
        <div class="box_left1">
            <div class="boxtop1">
                <div class="boxtop1_title">相关已解决问题</div>
            </div>
            <div class="box_left1_down">
                <ul class="wenti_xiagnguan">
                <!--{loop $solvelist $solve}-->
                    <li>·<a href="{url question/view/$solve['id']}" title="{$solve['title']}" target="_blank">{$solve['title']}</a>&nbsp;<span class="font_gray">{$solve['answers']}个回答</span></li>
                <!--{/loop}-->
                </ul>
               
            </div>
        </div>
        <!--相关已解决问题 结束-->
        <div class="blank10">
        </div>
        <!--分享 开始-->
        <div class="box_left1">
            <div class="box_left1_down" id="left2"></div>
        </div>
        <!--分享 结束-->
    </div>
    <!--内容左栏 end-->

    <!--内容右栏 begin-->
    <div class="boxthree">
        <div class="box_left_nav"></div>
        <!--网友正在问 beigin-->
        <div class="boxthree4">
            <div class="boxtop2">
                <div onmouseover="show_tabz1(21)" id="zbfa021" class="boxtop2A">网友正在问</div>
                <div class="boxtop2x"></div>
                <div onmouseover="show_tabz1(22)" id="zbfa022" class="boxtop2B">赏金求答案</div>
            </div>
            <div  id="zblia021">
                <table class="right_zhengwen" border="0" cellpadding="0" cellspacing="0" width="100%">
                    {eval $nosolvelist=$this->fromcache('nosolvelist');}
                    <!--{loop $nosolvelist $index $nosolve}-->
		     {eval ++$index;}
                    <tr>
                        <td class="wid190">·<a href="{url question/view/$nosolve['id']}" target="_blank">{$nosolve['title']}</a></td>
                        <td class="wid40">{$nosolve['price']}</td>
                    </tr>
                    <!--{/loop}-->
                </table>
                <div style="text-align: right; padding-right: 5px; line-height: 22px;">
                    <a href="{url category/list/1}" target="_blank">更多&gt;&gt;</a>
                </div>
            </div>
            <div  style="display:none;" id="zblia022">
                <table class="right_zhengwen" border="0" cellpadding="0" cellspacing="0" width="100%">
                    {eval $rewardlist=$this->fromcache('rewardlist');}
                    <!--{loop $rewardlist $index $reward}-->
		     {eval ++$index;}
                    <tr>
                        <td class="wid190">·<a href="{url question/view/$reward['id']}" target="_blank">{$reward['title']}</a></td>
                        <td class="wid40">{$reward['price']}</td>
                    </tr>
                    <!--{/loop}-->
                </table>
                <div style="text-align: right; padding-right: 5px; line-height: 22px;">
                    <a href="{url category/list/4}" target="_blank">更多&gt;&gt;</a>
                </div>
            </div>
        </div>
        <!-- 网友正在问 end-->
        <!--广告位
        <div id="divAds2"></div>
        -->
        <div class="blank10">
        </div>
        <!--积分排行榜开始-->
        <div class="boxthree4">
            <div class="boxtop2">
                <div class="boxtop2A" id="zbf021" onmouseover="show_tabz(21)">达人飙升榜</div>
                <div class="boxtop2x"></div>
                <div class="boxtop2B" id="zbf022" onmouseover="show_tabz(22)">总积分榜</div>
            </div>
            <div id="zbli021">
                <table class="blue" border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td width="11%"></td>
                        <td width="68%"><strong>用户名</strong></td>
                        <td style="text-align: right;" width="21%"><strong>得分</strong></td>
                    </tr>
                    {eval $weekuserlist=$this->fromcache('weekuserlist');}
                    <!--{loop $weekuserlist $index $weekuser}-->
					{eval ++$index;}
                    <tr>
                        <td><div class="boxthree4paihang1">{$index}</div></td>
                        <td><a  href="{url user/space/$weekuser['uid']}"  target="_blank">{$weekuser['username']}</a><a></a></td>
                        <td class="b888" style="text-align: right;">{$weekuser['credit1']}</td>
                    </tr>
                    <!--{/loop}-->
                </table>
                <div style="text-align: right; padding-right: 5px; line-height: 22px;"><a target="_blank" href="{url user/scorelist/1}">更多&gt;&gt;</a></div>
            </div>
            <div id="zbli022" style="display: none;">
                <table class="blue" border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td width="11%">　</td>
                        <td width="68%"><strong>用户名</strong></td>
                        <td style="text-align: right;" width="21%"><strong>得分</strong></td>
                    </tr>
                    {eval $alluserlist=$this->fromcache('alluserlist');}
                    <!--{loop $alluserlist $index $alluser}-->
					{eval ++$index;}
                    <tr>
                        <td><div class="boxthree4paihang1">{$index}</div></td>
                        <td><a  href="{url user/space/$alluser['uid']}"  target="_blank">{$alluser['username']}</a><a></a></td>
                        <td class="b888" style="text-align: right;">{$alluser['credit1']}</td>
                    </tr>
                    <!--{/loop}-->
                </table>
                <div style="text-align: right; padding-right: 5px; line-height: 22px;"><a target="_blank" href="{url user/scorelist/0}">更多&gt;&gt;</a></div>
            </div>
        </div>
        <!--积分排行榜结束-->
        <div class="blank10">
        </div>
    </div>
    <!--内容右栏 end-->
    <div class="clear">
    </div>
</div>
<!--{if $setting['editor_on'] }-->
<script type="text/javascript" src="{SITE_URL}js/xheditor/xheditor-zh-cn.min.js"></script>
<!--{/if}-->


<script type="text/javascript">
    var user=null;
    $.getJSON(g_site_url+"index.php?user/ajaxheader/"+Math.random(),function(myuser){
        user=myuser;
        if(0!=$question['authorid'] && $question['authorid']==user.uid){
            $('#dealQuestion').show();
            $("div[id^='apt']").show();
        }else{
            already=(0!=$('#asr'+user.uid).size());
            if(already){
                $('#eaopt'+user.uid).show();
            }else{
                $('#asropt').show();
                showeditor('mycontent');
            }
        }
    });
    
    //回答问题
    function mylogin(){
        var content=$('#mycontent').val();
        if(bytes(content)<=10){
            alert('回答内容不能少于10个字！');
            return;
        }
        if(0==user.uid){
            $.dialog({
                id:'loginDiv',
                position:'center',
                align:'left',
                fixed:1,
                width:300,
                height:100,
                title:'提交回答',
                okText:'登录并提交回答',
                fnOk:function(){
                    var username=$('#myusername').val();
                    var password=$('#mypassword').val();
                    $.ajax({
                        type: "post",
                        url: "{url user/ajaxlogin}",
                        data: "username="+username+"&password="+password,
                        success: function(msg){
                            if(1==msg){
                                $.dialog.close('loginDiv');document.answerForm.submit();
                            }else{
                                alert('用户名或密码错误！');
                            }
                        }
                    });
                },
                content:'<p /><table cellspacing="0" cellpadding="0" width="70%" border="0" valign="top"><tr><td class="f14" valign="top" nowrap align="left" width="40%" height="35">用户名 :&nbsp;&nbsp; </td><td valign="top" width="60%" height="35"><input maxlength="20" id="myusername" name="username"> </td></tr><tr><td class="f14" valign="top" nowrap align="left" height="35"> 密&nbsp&nbsp码 :&nbsp;&nbsp; </td><td valign="top" height="35"><input id="mypassword" type="password" maxlength="32" name="password"></td></tr></table>'
            });
        }else{
            document.answerForm.submit();
        }
    }

    //追加悬赏
    function addscore(){
        $.dialog({
            id:'addscoreDiv',
            position:'center',
            align:'left',
            fixed:1,
            width:300,
            height:100,
            title:'追加悬赏',
            fnOk:function(){document.addscoreForm.submit();$.dialog.close('addscoreDiv')},
            fnCancel:function(){$.dialog.close('addscoreDiv')},
            content:'&nbsp;&nbsp;&nbsp;&nbsp;提问期内，追加悬赏一次，可延长问题的有效期3天。<br />&nbsp;&nbsp;&nbsp;&nbsp;当您一次悬赏的财富值高于20分时，该问题将等同于新提出的问题，在所属分类的问题列表中显示为最新。 <div class="b4 bcg mb12"><form name="addscoreForm"  action="{url question/addscore/$question['id']}" method="post" >追加悬赏<select name="score"><option value="5" selected="selected">5</option><option value="10">10</option><option value="15">15</option><option value="20">20</option><option value="30">30</option><option value="40">40</option><option value="50">50</option></select>分</form></div>'
        });
    }

    //问题补充
    function mysupply(){
        $.dialog({
            id:'supplyDiv',
            position:'center',
            align:'left',
            fixed:1,
            width:600,
            title:'补充问题',
            fnOk:function(){editor.getSource();document.supplyForm.submit();$.dialog.close('supplyDiv')},
            fnCancel:function(){$.dialog.close('supplyDiv')},
            content:'补充提问细节，以得到更准确的答案。<div><form name="supplyForm"  action="{url question/supply/$question['id']}" method="post" ><textarea id="mysupply" name="content" style="width: 95%; padding-top: 1px; font-size: 14px;"   rows="12" cols="100" ></textarea></form></div>'
        });
        editor=showeditor('mysupply');
    }

    //问题管理
    function managequest(num){
        switch(num){
            case 1:
                $.dialog({
                    id:'renametitle',
                    position:'center',
                    align:'left',
                    fixed:1,
                    width:300,
                    height:100,
                    title:'修改问题标题',
                    fnOk:function(){document.renameForm.submit();$.dialog.close('renametitle')},
                    fnCancel:function(){$.dialog.close('renametitle')},
                    content:'<div class="mainbox"><form name="renameForm"  action="{url question/edittitle}" method="post" ><input type="hidden" value="{$question['id']}" name="qid"/>问题标题：<br /><input type="text" name="title" value="{$question['title']}" class="txt" size="45" /></form></div>'});
                break;
            case 2:
            	var description=$('#mydescription').html();
                $.dialog({
                    id:'editquesDiv',
                    position:'center',
                    align:'left',
                    fixed:1,
                    width:600,
                    title:'修改问题内容',
                    fnOk:function(){editor.getSource();document.editquescontForm.submit();$.dialog.close('editquesDiv')},
                    fnCancel:function(){$.dialog.close('editquesDiv')},
                    content:'<div>标题：{$question['title']}<br /><form name="editquescontForm"  action="{url question/editcont}" method="post" ><textarea id="mc" name="content" style="width: 95%; padding-top: 1px; font-size: 14px;" rows="10" >'+description+'</textarea><input type="hidden"  value="{$question[id]}" name="qid"/></form></div>'
                });
                editor=showeditor("mc");
                break;
            case 2:
                if(!confirm('确定删除问题？该操作不可返回！')==false){
                    document.location.href="{url index/default}";
                }
                break;
            case 3:
                $.dialog({
                    id:'editcatediv',
                    position:'center',
                    align:'left',
                    fixed:1,
                    width:300,
                    height:100,
                    title:'移动分类',
                    fnOk:function(){document.askform.submit();$.dialog.close('editcatediv')},
                    fnCancel:function(){$.dialog.close('editcatediv')},
                    content:'<div class="mainbox">请选择要移动到的分类：<form name="askform" action="{url question/movecategory}" method="post" ><input type="hidden" name="qid" value="{$question['id']}" /><select name="category" size=1 style="width:240px" >{$catetree}</select></form></div>'  });
                break;
            case 4:
                if(!confirm('确定关闭该问题?')==false){
                    document.location.href="{url question/close/$question['id']}";
                }
                break;
            case 5:
                document.location.href="{url question/recommend/$question['id']}";
                break;
            case 6:
                if(!confirm('确定删除问题？该操作不可返回！')==false){
                    document.location.href="{url question/delete/$question['id']}";
                }
                break;
            default:
                alert("非法操作！");
                break;
        }
    }

    //修改回答
    function editanswer(aid,mcdivid){
        var mc_content=$('#'+mcdivid).html();
        if('undefined'== typeof KE) mc_content=$.trim(mc_content.replaceAll("<br>","\n"));
        $.dialog({
            id:'editanswerDiv',
            position:'center',
            align:'left',
            fixed:1,
            width:600,
            title:'修改回答',
            fnOk:function(){editor.getSource();document.editanswerForm.submit();$.dialog.close('editanswerDiv')},
            fnCancel:function(){$.dialog.close('editanswerDiv')},
            content:user.username+',您要修改的回答如下: <div><form name="editanswerForm"  action="{url question/editanswer}" method="post" ><textarea id="mc" name="content" style="width: 95%; padding-top: 1px; font-size: 14px;" rows="12" cols="100" >'+mc_content+'</textarea><input type="hidden"  value="{$question['id']}" name="qid"/><input type="hidden" id="ma" value="'+aid+'" name="aid"/></form></div>'
                
        });
        editor=showeditor('mc');
    }

        //管理回答
        function adoptanswer(aid){
            $.dialog({
                id:'editanswerDiv',
                position:'center',
                align:'left',
                fixed:1,
                width:500,
                title:'采纳感言',
                fnOk:function(){document.editanswerForm.submit();$.dialog.close('editanswerDiv')},
                fnCancel:function(){$.dialog.close('editanswerDiv')},
                content:'对该回答的感言： <div><form name="editanswerForm"  action="{url question/adopt}" method="post" ><textarea id="mc" name="content" style="width: 95%; padding-top: 1px; font-size: 14px;" rows="8" cols="300" >谢谢您的解答！</textarea><input type="hidden"  value="{$question['id']}" name="qid"/><input type="hidden" id="ma" value="'+aid+'" name="aid"/></form></div>'
            });
        }

    //删除回答
    function delanswer(aid,qid){
        if(confirm("确定删除该回答?")){
            document.location.href='{url question/deleteanswer/'+aid+'/'+qid+'}';
        }
    }
    //审核回答
    function verifyanswer(aid){
    	document.location.href='{url question/verifyanswer/'+aid+'/'+qid+'}';
    }
    
</script>
<script type="text/javascript">
    <!--用户排行切换-->
    function show_tabz1(num){
        for(i=0;i<100;i++){
            if(document.getElementById('zbfa0'+i)){
                document.getElementById('zbfa0'+i).className='boxtop2B';
                document.getElementById('zblia0'+i).style.display='none';
            }
        }
        document.getElementById('zbfa0'+num).className='boxtop2A';
        document.getElementById('zblia0'+num).style.display='block';
    }
    function show_tabz(num){
        for(i=0;i<100;i++){
            if(document.getElementById('zbf0'+i)){
                document.getElementById('zbf0'+i).className='boxtop2B';
                document.getElementById('zbli0'+i).style.display='none';
            }
        }
        document.getElementById('zbf0'+num).className='boxtop2A';
        document.getElementById('zbli0'+num).style.display='block';
    }

    function inform(name,type){
        var content = name+'的回答';
        if(type==1){
            content = name+'的提问';
        }
        $.dialog({
            id:'informDiv',
            position:'center',
            align:'left',
            fixed:1,
            width:500,
            title:'举报',
            fnOk:function(){document.informform.submit();$.dialog.close('informDiv')},
            fnCancel:function(){$.dialog.close('informDiv')},
            content:'<div style="display: block; border-bottom: 1px dotted rgb(136, 136, 136);" class="font_orange2">如果您发现不正当的内容或行为，请及时联系管理员！</div><form name="informform" action="{url inform/add}" method="POST"> <div><p><strong>举报内容：</strong>'+content+'</p><p><strong>举报原因：</strong>(可多选)</p><p><input type="checkbox" name="informkind[]" value="0" />含有反动的内容</p><p><input type="checkbox" name="informkind[]" value="1" />含有人身攻击的内容</p><p><input type="checkbox" name="informkind[]" value="2" />含有广告性质的内容</p><p><input type="checkbox" name="informkind[]" value="3" />涉及违法犯罪的内容</p><p><input type="checkbox" name="informkind[]" value="4" />含有违背伦理道德的内容</p><p><input type="checkbox" name="informkind[]" value="5" />含色情、暴力、恐怖的内容</p><input type="checkbox" name="informkind[]" value="5" />含有恶意无聊灌水的内容</p></div><input type="hidden"  value="{$question['id']}" name="qid"/><input type="hidden"  value="'+content+'" name="content"/><input type="hidden"  value="{$question['title']}" name="title"/></from>'
        });
    }
    $(document).ready(share);
</script>
{template footer}